<?php namespace App\Models;

use Illuminate\Database\Eloquent\Model;

/**
 * 投票详情
 * Class VoteDetail
 *
 * @package App\Models
 * @property int $id
 * @property string $created_at
 * @property string $updated_at
 * @property int $vote_id
 * @property int $rater_id
 * @property int $works_id
 * @property int $score
 * @property-read \App\Models\Vote $vote
 * @property-read \App\Models\Works $works
 * @property-read \App\Models\Rater $rater
 * @method static \Illuminate\Database\Query\Builder|\App\Models\VoteDetail whereId($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Models\VoteDetail whereCreatedAt($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Models\VoteDetail whereUpdatedAt($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Models\VoteDetail whereVoteId($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Models\VoteDetail whereRaterId($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Models\VoteDetail whereWorksId($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Models\VoteDetail whereScore($value)
 * @mixin \Eloquent
 */
class VoteDetail extends Model
{

    protected $fillable = ['vote_id', 'rater_id', 'works_id', 'score'];

    /**
     * 投票池
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function vote()
    {
        return $this->belongsTo(Vote::class, 'vote_id');
    }

    /**
     * 作品
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function works()
    {
        return $this->belongsTo(Works::class, 'works_id');
    }

    /**
     * 评委
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function rater()
    {
        return $this->belongsTo(Rater::class, 'rater_id');
    }
}